import { quickStartExample, interactiveExample, mockExample } from './examples/quick-start';
import { basicAgentExample, weatherAgentExample, multiServerExample } from './examples/agent-examples';
import { multiRoundToolExample, explainMultiRoundLogic } from './examples/multi-round-example';

async function main() {
  console.log('🚀 AI Agent MCP Tutorial Examples');
  console.log('==================================');
  
  const args = process.argv.slice(2);
  const example = args[0] || 'quick-start';
  
  switch (example) {
    case 'quick-start':
      console.log('Running Quick Start Example...\n');
      await quickStartExample();
      break;
      
    case 'mock':
      console.log('Running Mock Example...\n');
      await mockExample();
      break;
      
    case 'interactive':
      console.log('Running Interactive Example...\n');
      await interactiveExample();
      break;
      
    case 'basic':
      console.log('Running Basic Agent Example...\n');
      await basicAgentExample();
      break;
      
    case 'weather':
      console.log('Running Weather Agent Example...\n');
      await weatherAgentExample();
      break;
      
    case 'multi-server':
      console.log('Running Multi-Server Example...\n');
      await multiServerExample();
      break;
      
    case 'multi-round':
      console.log('Running Multi-Round Tool Calling Example...\n');
      await multiRoundToolExample();
      break;
      
    case 'explain-multi-round':
      console.log('Multi-Round Tool Calling Explanation...\n');
      explainMultiRoundLogic();
      break;
      
    case 'help':
      console.log('Available examples:');
      console.log('  quick-start      - Basic quick start example');
      console.log('  mock             - Mock example (no server required)');
      console.log('  interactive       - Interactive demo with user input');
      console.log('  basic           - Basic agent functionality');
      console.log('  weather         - Weather-specific agent');
      console.log('  multi-server    - Agent with multiple MCP servers');
      console.log('  multi-round     - Multi-round tool calling example');
      console.log('  explain-multi-round - Explanation of multi-round logic');
      console.log('  help            - Show this help message');
      break;
      
    default:
      console.log(`Unknown example: ${example}`);
      console.log('Use "npm run dev help" to see available examples');
  }
  
  console.log('\n✅ Example completed');
}

if (require.main === module) {
  main().catch(error => {
    console.error('Example failed:', error);
    process.exit(1);
  });
}

export { main };